package com.isoft.c2team3service2.entity;

import com.baomidou.mybatisplus.annotation.*;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.web.multipart.MultipartFile;

import java.math.BigDecimal;
import java.time.LocalDateTime;

@Data
@NoArgsConstructor
@AllArgsConstructor
@TableName("post")
public class Post {
    @TableId(type = IdType.AUTO)
    private Integer id;
    private String title;
    @TableField(fill = FieldFill.INSERT_UPDATE)
    private String nickName;
    private String content;
    private Integer userId;
    // 0:草稿 1:发布 2:审核中 3:已删除
    private Integer status;
    // 评论数
    private Integer commentCount;
    // 浏览量
    private Integer viewCount;
    // 点赞数
    private Integer likeCount;
    // 图片地址
    @TableField(updateStrategy = FieldStrategy.NOT_NULL)
    private String photoUrl;
//    @TableField(updateStrategy = FieldStrategy.NOT_NULL)
//    private String headEmail;

    //私密帖子
// Post实体类中
    @TableField(
            updateStrategy = FieldStrategy.NOT_NULL,
            fill = FieldFill.INSERT
    )
    private Integer isPrivate = 0; // 代码层面默认值，避免null

    // 新增过滤后内容字段
    private String filteredContent;

    @TableField(fill = FieldFill.INSERT)
    private LocalDateTime createTime;

    @TableField(fill = FieldFill.INSERT_UPDATE)
    private LocalDateTime updateTime;

    // 新增付费相关字段
    @TableField(fill = FieldFill.INSERT,updateStrategy = FieldStrategy.NOT_NULL)
    private Integer isPaid = 0;

    @TableField(updateStrategy = FieldStrategy.NOT_NULL) // 允许为null（非付费帖子可不填）
    private BigDecimal price; // 付费金额
    // 新增：关联艺人名称（映射数据库artistName字段）
    private String artistName;

    // 非数据库字段：用于关联查询时返回艺人详情
    @TableField(exist = false)
    private Artist artist; // 关联的艺人信息
}
